'\" te
.\" Copyright (c) 2000-2007 AT&T Knowledge Ventures
.\" To view license terms, see http://www.opensource.org/licenses/cpl1.0.txt
.\" Portions Copyright (c) 2007, Sun Microsystems, Inc.
.TH MSGCC 1 "Oct 9, 2007"
.SH NAME
msgcc \- C language message catalog compiler
.SH SYNOPSIS
.LP
.nf
\fBmsgcc\fR [\fB-M-\fR\fIoption\fR] [\fBcc-options\fR\fIoption\fR] \fIfile...\fR
.fi

.SH DESCRIPTION
.sp
.LP
\fBmsgcc\fR is a C language message catalog compiler. It accepts \fBcc\fR style
options and arguments.
.sp
.LP
A \fBmsgcpp\fR(1) \fB\&.mso\fR file is generated for each input \fB\&.c\fR
file. If the \fB-c\fR option is not specified then a \fBgencat\fR(1)
format .\fBmsg\fR file is generated from the input \fB\&.mso\fR and \fB\&.msg\fR
files. If \fB-c\fR is not specified then a \fB\&.msg\fR suffix is appended to
the \fB-o\fR file if it doesn't already have a suffix. The default output is
\fBa.out.msg\fR if \fB-c\fR and \fB-o\fR are not specified.
.sp
.LP
If \fB-M-new\fR is not specified then messages are merged with those in the
pre-existing \fB-o\fR file.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fIcc-options\fR\fR
.ad
.RS 14n
Specify \fBcc\fR style options and arguments.
.RE

.sp
.ne 2
.na
\fB\fB-M-\fR\fIoption\fR\fR
.ad
.RS 14n
Set a \fBmsgcc\fR option.
.sp
Specify option as one of the following:
.sp
.ne 2
.na
\fB\fBmkmsgs\fR\fR
.ad
.RS 18n
The \fB-o\fR file is assumed to be in \fBmkmsgs\fR(1) format.
.RE

.sp
.ne 2
.na
\fB\fBnew\fR\fR
.ad
.RS 18n
Create a new \fB-o\fR file.
.RE

.sp
.ne 2
.na
\fB\fBpreserve\fR\fR
.ad
.RS 18n
Messages in the \fB-o\fR file that are not in new \fB\&.msg\fR file arguments
are preserved. The default is to either reuse the message numbers with new
message text that is similar to the old or to delete the message text, leaving
an unused message number.
.RE

.sp
.ne 2
.na
\fB\fBset=\fR\fInumber\fR\fR
.ad
.RS 18n
Set the message set number to \fInumber\fR. The default is \fB1\fR.
.RE

.sp
.ne 2
.na
\fB\fBsimilar=\fR\fInumber\fR\fR
.ad
.RS 18n
The message text similarity message threshold. The similarity measure between
old and new message text is:
.sp
.in +2
.nf
100*(2*gzip(\fIold\fR+\fInew\fR)\e
     /(gzip(\fIold\fR)+gzip(\fInew\fR))-1)
.fi
.in -2
.sp

where \fBgzip(\fR\fIx\fR\fB)\fR is the size of text \fIx\fR when compressed by
\fBgzip\fR. The default threshold is \fB$__similar__$.A\fR threshold of \fB0\fR
turns off message replacement, but unused old messages are still deleted. Use
\fB-M-preserve\fR to preserve all old messages.
.RE

.sp
.ne 2
.na
\fB\fBverbose\fR\fR
.ad
.RS 18n
Trace similar message replacements on the standard error.
.RE

.RE

.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.na
\fB\fIfile\fR\fR
.ad
.RS 8n
Specifies the name of the file on which \fBmsgcc\fR operates.
.RE

.SH EXIT STATUS
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 6n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
An error occurred.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRUsing \fBmsgcc\fR
.sp
.LP
The following example uses \fBmsgcc\fR to extract localizable strings from the
file \fBhello.c\fR, marked using \fBERROR_dictionary()\fR, writes them to the
file \fBhello.mso\fR, and creates a \fBgencat\fR format \fBxxx.msg\fR file:

.sp
.in +2
.nf
example% cat hello.c

#include <stdio.h>
#include <stdlib.h>

/*
 * dummy macro to avoid including
 * libast headers
 */
#define ERROR_dictionary(x) x

int main(int ac, char *av[])
{
        puts( ERROR_dictionary("hello world") );
        return( EXIT_SUCCESS );
}

example% msgcc -o xxx -D__STDC__ -D__i386 hello.c

example% cat hello.mso
str "hello world"

example% cat xxx.msg
$ xxx message catalog
$translation msgcc 2007-09-25
$set 1
$quote "
1 "hello world"
.fi
.in -2
.sp

.SH AUTHORS
.sp
.LP
Glenn Fowler, \fBgsf@research.att.com\fR
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Volatile
.TE

.SH SEE ALSO
.sp
.LP
.BR cpp (1),
.BR gencat (1),
.BR mkmsgs (1),
.BR msgcpp (1),
.BR msgcvt (1),
.BR msggen (1),
.BR attributes (7)
